﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="New.aspx.cs" Inherits="Bookmark.Net.Views.Item.New" %>
<%@ Import Namespace="Bookmark.Net.Controllers" %>
<%@ Import Namespace="Bookmark.Net.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BreadCrumbsPlaceHolder" runat="server">
<%=Html.RenderUserControl("~/Views/Item/BreadCrumbs.ascx", ViewData) %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainMenuPlaceHolder" runat="server">
<%=Html.RenderUserControl("~/Views/Item/MainMenu.ascx", ViewData) %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="SearchBarPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<% if (ViewData.ErrorMessage != null){ %>
  <font color="red"><%=ViewData.ErrorMessage%></font>
<% } %>
<%using (Html.Form<ItemController>(c => c.Create())) 
  {%>

<table>
<tr><td>url</td><td><%= Html.TextBox("Item.ShortCut", ViewData.Item.ShortCut)%></td><td></td></tr>
<tr><td>title</td><td><%= Html.TextBox("Item.Title", ViewData.Item.Title)%></td><td></td></tr>
<tr><td>description</td><td><%= Html.TextBox("Item.Description", ViewData.Item.Description)%></td><td></td></tr>

<tr><td>tags</td><td><%= Html.TextBox("TagString", ViewData.TagString)%></td><td> space separated</td></tr>
<tr><td><%= Html.SubmitButton("submit", "Save") %></td><td></td><td></td></tr>
</table>
<%} %>
<br />
<br />
<div class="yourTags">
<h2>your tags</h2>
<%if (ViewData.Tags != null)
  { %>
  <script>
  function addTag(tag){
    document.getElementById("TagString").setAttribute("value", document.getElementById("TagString").getAttribute("value") + " " + tag);
  }
  </script>
<% foreach (Tag t in ViewData.Tags)
   { %>
   <a href="javascript:addTag('<%= t.TagName %>')"><%= t.TagName %></a>
 <%} %>
<%} %>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="RelatedTagsPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="TagsPlaceHolder" runat="server">
</asp:Content>
